/*
验证功能: vector<>::clear() 清空数据, 不释放内存, 改变大小为0
*/
#include <iostream>
#include <vector>
#include <stdio.h>
#include <stdint.h>
#include <algorithm>
using namespace std;

struct Student {
    uint32_t id;
    string name;
    uint32_t age;
    uint32_t score;
};

int main()
{
    vector<Student> v = {
        {1,"Lili",18,70},
        {2,"Alici",19,90},
        {3,"Tom",20,80},
        {4,"Jack",21,40},
        {5,"Jerry",22,60},
    };
    sort(v.begin(), v.end(),
        [](const Student& a, const Student& b) {
            return a.score > b.score;
        }
    );
    for (auto& i : v) {
        printf("id:%u, name:%s, age:%u, score:%u\n", i.id, i.name.c_str(), i.age, i.score);
    }

    return 0;
}